from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep

import sys

sys.path.append(r'..')
from web_base.base_page import BasePage
from page_object.login_page import LoginPage


class AssetPage(BasePage):
    url = r'/bsams/front/asset/asset_list.do'
    # 存放地点查询
    location_btn_loc = (By.ID, 'status')
    location_title_loc = (By, 'title')
    location_ok_loc = (By.CLASS_NAME, 'search_button')

    def test_location(self, status, title):
        self.ele_click(self.location_btn_loc, status)
        self.input_ele(self.location_title_loc, title)
        self.ele_click(self.location_ok_loc)
        sleep(3)
        text = self.get_alert_text()
        self.alert_click()
        return text
